#include "../Log/sqylog.hpp"
#include <unistd.h>
int main()
{
    std::unique_ptr<sqy_log::LoggerBuilder> builder(new sqy_log::GlobalLoggerBuilder());
    builder->buildFormatter("[%c][%f:%l]%m%n");
    builder->buildLoggerLevel(sqy_log::LogLevel::value::WARING);
    builder->buildLoggerName("async_logger");
    builder->buildLoggerType(sqy_log::LoggerType::LOGGER_ASYNC);
    builder->buildSink<sqy_log::RollByTimeSink>("./logfile/roll-async-by-size",sqy_log::TimeGap::GAP_SECOND);
    sqy_log::Logger::ptr logger = builder->build();
    size_t cur = sqy_log::util::Date::now();
    while(sqy_log::util::Date::now() < cur + 5)
    {
        logger->fatal("这是一条日志");
        usleep(1000);
    }
    return 0;
}